/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.eventos.be;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author lizardo
 */
@Entity
@Table(name = "eca_entrega_material")
@NamedQueries({@NamedQuery(name = "EntregaMaterial.findAll", query = "SELECT e FROM EntregaMaterial e"), @NamedQuery(name = "EntregaMaterial.findByEmaCodigo", query = "SELECT e FROM EntregaMaterial e WHERE e.emaCodigo = :emaCodigo"), @NamedQuery(name = "EntregaMaterial.findByMacCodigo", query = "SELECT e FROM EntregaMaterial e WHERE e.macCodigo = :macCodigo"), @NamedQuery(name = "EntregaMaterial.findByEmaEstado", query = "SELECT e FROM EntregaMaterial e WHERE e.emaEstado = :emaEstado"), @NamedQuery(name = "EntregaMaterial.findByEmaActivo", query = "SELECT e FROM EntregaMaterial e WHERE e.emaActivo = :emaActivo")})
public class EntregaMaterial implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ema_codigo")
    private Integer emaCodigo;
    @Basic(optional = false)
    @Column(name = "ema_estado")
    private boolean emaEstado;
    @Basic(optional = false)
    @Column(name = "ema_activo")
    private boolean emaActivo;
    @JoinColumn(name = "mat_codigo", referencedColumnName = "mat_codigo")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Matricula matCodigo;
    @JoinColumn(name = "mac_codigo", referencedColumnName = "mac_codigo")
    @ManyToOne(optional= false, fetch = FetchType.LAZY)
    private MaterialAcademico macCodigo;

    public EntregaMaterial() {
    }

    public EntregaMaterial(Integer emaCodigo) {
        this.emaCodigo = emaCodigo;
    }

    public EntregaMaterial(Integer emaCodigo, boolean emaEstado, boolean emaActivo) {
        this.emaCodigo = emaCodigo;
        this.emaEstado = emaEstado;
        this.emaActivo = emaActivo;
    }

    public Integer getEmaCodigo() {
        return emaCodigo;
    }

    public void setEmaCodigo(Integer emaCodigo) {
        this.emaCodigo = emaCodigo;
    }

    public boolean getEmaEstado() {
        return emaEstado;
    }

    public void setEmaEstado(boolean emaEstado) {
        this.emaEstado = emaEstado;
    }

    public boolean getEmaActivo() {
        return emaActivo;
    }

    public void setEmaActivo(boolean emaActivo) {
        this.emaActivo = emaActivo;
    }

    public Matricula getMatCodigo() {
        return matCodigo;
    }

    public void setMatCodigo(Matricula matCodigo) {
        this.matCodigo = matCodigo;
    }

    public MaterialAcademico getMacCodigo() {
        return macCodigo;
    }

    public void setMacCodigo(MaterialAcademico macCodigo) {
        this.macCodigo = macCodigo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (emaCodigo != null ? emaCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EntregaMaterial)) {
            return false;
        }
        EntregaMaterial other = (EntregaMaterial) object;
        if ((this.emaCodigo == null && other.emaCodigo != null) || (this.emaCodigo != null && !this.emaCodigo.equals(other.emaCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.eventos.be.EntregaMaterial[emaCodigo=" + emaCodigo + "]";
    }

    @Transient

    private Boolean seleccion;

    public Boolean getSeleccion() {
        return seleccion;
    }

    public void setSeleccion(Boolean seleccion) {
        this.seleccion = seleccion;
    }



}
